package com.test.servlets;

import com.google.gson.Gson;
import com.test.dao.StudentDAO;
import com.test.entity.Clazz;
import com.test.entity.Student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

@WebServlet("/AjaxServlet")
public class AjaxServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        List<Student> list = StudentDAO.getInstance().queryAll();
//        Gson gson = new Gson();
//        String json = gson.toJson(list);
//        resp.setContentType("application/json; charset=UTF-8");
//        resp.getWriter().write(json);
    }
}
